package com.qf.sale.controller;

import com.qf.lw.pojo.GoodsPojo;
import com.qf.lw.pojo.GoodsTypePojo;
import com.qf.sale.service.IIndexService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class IndexController {
   @Autowired
    IIndexService indexService;
    @RequestMapping("index")
    public String index(Model model){
        //查询商品类别列表 只查询了3个类别
        List<GoodsTypePojo> list =indexService.queryGoodsTypes();
        //查询6个商品;
        List<GoodsPojo> goodslist=indexService.queryGoods();
        model.addAttribute("goodsTypeList",list);
        model.addAttribute("goodsList",goodslist);
        return "index";
    }
    }
